Skip to content

#6339 Improve message content isolation - #6340

Merged
sosnovsky merged 5 commits into
masterfrom
issue-6339-harden-css-sanitizer
Nov 20, 2026
Merged

sosnovsky merged 5 commits into
masterfrom
issue-6339-harden-css-sanitizer

Conversation

@martgil

@martgil martgil commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

This PR removes negative margins in both CSS sanitizers so untrusted message content cannot be displaced over trust UI.

close #6339


Tests (delete all except exactly one):

  • Tests added or updated

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • if this PR fixes a security issue: I tried to bypass the new fix, and failed (leave unticked if this PR is not a security fix)
  • is documented clearly and usefully, or doesn't need documentation

Allowlisted negative margins let untrusted message content escape its
container and repaint trust UI. Both CSS sanitizers now remove margin
declarations with negative lengths, with regression tests for shorthand,
calc(), !important and logical-property variants.
@martgil
martgil requested a review from sosnovsky as a code owner November 18, 2026 07:37
Strip var()/attr()/env() margins and positioning offsets, and stop
stripping valid positive calc() margins. Extends regression tests with
the bypass variants found in review.
@martgil

This comment was marked as outdated.

Comment thread extension/js/common/platform/xss.ts Resolved
@martgil
martgil requested a review from sosnovsky November 20, 2026 04:11
@martgil

martgil commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @sosnovsky - This one is ready for a review again. Thanks!

@sosnovsky sosnovsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sosnovsky
sosnovsky merged commit 9cb9905 into master Nov 20, 2026
12 checks passed
@sosnovsky
sosnovsky deleted the issue-6339-harden-css-sanitizer branch November 20, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve message content isolation

2 participants